import {Tabs ,TabsProps} from 'antd';
import { FC ,useState,useEffect} from 'react'
import ComponentProps from './ComponentProps';
import QuestionInfo from './QuestionInfo';

import useGetQuestion from '../../hooks/useGetQuestion';


const items: TabsProps['items'] = [
    {
      key: 'componentLib',
      label: '控件属性',
      children: <ComponentProps></ComponentProps>,
    },
    {
      key: 'layers',
      label: '问卷属性',
      children: <QuestionInfo></QuestionInfo>,
    }
  ];
const RightPanel:FC = ()=>{
  const [ActiveKey, setActiveKey] = useState("componentLib");
  const {selectedId} = useGetQuestion()
  useEffect(() => {
    if (selectedId == "") {
      setActiveKey("layers");
    } else {
      setActiveKey("componentLib");
    }
  }, [selectedId]);
  return <>
      <Tabs activeKey={ActiveKey} items={items}  />
  </>
}

export default RightPanel